<!--
  运营-招聘管理-【招聘职位】
 -->
<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="发布中" name="1">
        <!-- 搜索工作栏 -->
        <el-form
          ref="leftQueryForm"
          :model="leftQueryParams"
          size="small"
          :inline="true"
          label-width="68px"
        >
          <el-form-item label="职位名称" prop="jobName">
            <el-input
              v-model="leftQueryParams.jobName"
              placeholder="请输入职位名称"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="操作人" prop="updater">
            <el-input
              v-model="leftQueryParams.updater"
              placeholder="请输入操作人"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button
              icon="el-icon-refresh"
              @click="resetQuery"
            >重置</el-button>
            <el-button
              type="primary"
              icon="el-icon-search"
              @click="handleQuery"
            >搜索</el-button>
          </el-form-item>
        </el-form>
        <!-- 操作工具栏 -->
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
            >新增</el-button>
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="leftMultipleSelection.length === 0"
              @click="handleMutipleSetTop(leftMultipleSelection, '1')"
            >置顶</el-button>
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="leftMultipleSelection.length === 0"
              @click="handleMutipleSetTop(leftMultipleSelection, '0')"
            >取消置顶</el-button>
            <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="leftMultipleSelection.length === 0"
              @click="multipleSetStatus(leftMultipleSelection, '3')"
            >暂停发布</el-button>
            <el-button
              type="danger"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="leftMultipleSelection.length === 0"
              @click="deleteAll(leftMultipleSelection)"
            >删除</el-button>
          </el-col>
        </el-row>
        <!-- 列表 -->
        <el-table
          v-loading="loading"
          :data="leftList"
          @selection-change="handleLeftChange"
          @sort-change="({ column, prop, order }) => sortChange('left', { column, prop, order })"
        >
          <el-table-column type="selection" width="55" />
          <el-table-column label="序号" type="index" />
          <el-table-column label="职位名称" align="center" prop="jobName">
            <template slot-scope="scope">
              <img v-if="scope.row.topStatus === '1'" style="display:inline-block;width: 30px;vertical-align: middle;margin: 0 5px;" src="@/assets/images/topStatus.png" alt="" srcset="">
              <img v-if="scope.row.topStatus === '0'" style="display:inline-block;width: 30px;vertical-align: middle;margin: 0 5px;" src="@/assets/images/unTopStatus.png" alt="" srcset="">
              <span>{{ scope.row.jobName || "--" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="招聘企业" align="center" prop="companyName" />
          <el-table-column label="工作地点" align="center" prop="workPosition">
            <template slot-scope="scope">
              {{ scope.row.workPosition || "--" }}
            </template>
          </el-table-column>
          <el-table-column label="部门" align="center" prop="department" />
          <el-table-column label="操作人" align="center" prop="updater" />
          <el-table-column
            label="更新日期"
            align="center"
            prop="updateTime"
            width="180"
            sortable
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.updateTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="定时暂停发布时间" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.fixedTime || '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="职位状态" align="center" prop="status">
            <template slot-scope="scope">
              <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
              {{ statusList[scope.row.status] || "--" }}
            </template>
          </el-table-column>
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <!-- 刷新职位 -->
              <el-popconfirm
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确定刷新职位日期？"
                @confirm="handleFreshDate(scope.row)"
              >
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >刷新职位</el-button>
              </el-popconfirm>
              <!-- 置顶 -->
              <el-popconfirm
                v-if="scope.row.topStatus !== '1'"
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确定置顶职位？"
                @confirm="handleSetTop(scope.row, '1')"
              >
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >置顶</el-button>
              </el-popconfirm>
              <!-- 取消置顶 -->
              <el-popconfirm
                v-else
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确认取消置顶职位？"
                @confirm="handleSetTop(scope.row, '0')"
              >
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >取消置顶</el-button>
              </el-popconfirm>
              <!-- 暂停发布 -->
              <el-popconfirm
                v-if="Number(scope.row.status) === 2"
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确认暂停发布职位？"
                @confirm="handleSetStatus(scope.row, '3')"
              >
                <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >暂停发布</el-button>
              </el-popconfirm>
              <el-button
                v-if="Number(scope.row.status) === 2"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="setTimeChange(scope.row)"
              >定时暂停发布</el-button>
              <!-- 查看 -->
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="getJobData(scope.row)"
              >查看</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-share"
                @click="showShare(scope.row)"
              >分享</el-button>
              <el-button
                v-if="Number(scope.row.status) !== 4"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="showReason(scope.row)"
              >审核通过原因</el-button>
              <!-- 编辑 -->
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleEdit(scope.row)"
              >编辑</el-button>
              <!-- 删除 -->
              <el-popconfirm
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确认删除职位？"
                @confirm="handleDelete(scope.row)"
              >
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <pagination
          v-show="leftTotal > 0"
          :total="leftTotal"
          :page.sync="leftQueryParams.pageNo"
          :limit.sync="leftQueryParams.pageSize"
          @pagination="leftGetList"
        />
      </el-tab-pane>
      <el-tab-pane label="暂停发布" name="2">
        <!-- 搜索工作栏 -->
        <el-form
          ref="centerQueryForm"
          :model="centerQueryParams"
          size="small"
          :inline="true"
          label-width="78px"
        >
          <el-form-item label="职位" prop="jobName">
            <el-input
              v-model="centerQueryParams.jobName"
              placeholder="请输入职位"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="操作人" prop="updater">
            <el-input
              v-model="centerQueryParams.updater"
              placeholder="请输入操作人"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button
              icon="el-icon-refresh"
              @click="resetQuery"
            >重置</el-button>
            <el-button
              type="primary"
              icon="el-icon-search"
              @click="handleQuery"
            >搜索</el-button>
          </el-form-item>
        </el-form>
        <!-- 操作工具栏 -->
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
            >新增</el-button>
            <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="centerMultipleSelection.length === 0"
              @click="multipleSetStatus(centerMultipleSelection, '2')"
            >发布</el-button>
            <el-button
              type="danger"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="centerMultipleSelection.length === 0"
              @click="deleteAll(centerMultipleSelection)"
            >删除</el-button>
          </el-col>
        </el-row>
        <!-- 列表 -->
        <el-table
          v-loading="loading"
          :data="centerList"
          @selection-change="handleCenterChange"
          @sort-change="({ column, prop, order }) => sortChange('center', { column, prop, order })"
        >
          <el-table-column type="selection" width="55" />
          <el-table-column label="序号" type="index" />
          <el-table-column label="职位名称" align="center" prop="jobName" />
          <el-table-column label="招聘企业" align="center" prop="companyName" />
          <el-table-column label="工作地点" align="center" prop="workPosition">
            <template slot-scope="scope">
              {{ scope.row.workPosition || "--" }}
            </template>
          </el-table-column>
          <el-table-column
            label="更新日期"
            align="center"
            prop="updateTime"
            width="180"
            sortable
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.updateTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="部门" align="center" prop="department" />
          <el-table-column label="职位状态" align="center" prop="status">
            <template slot-scope="scope">
              <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
              {{ statusList[scope.row.status] || "--" }}
            </template>
          </el-table-column>
          <el-table-column label="定时发布时间" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.fixedTime || '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作人" align="center" prop="updater" />
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-popconfirm
                v-if="Number(scope.row.status) === 3"
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确认发布职位？"
                @confirm="handleSetStatus(scope.row, '2')"
              >
                <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >发布</el-button>
              </el-popconfirm>
              <el-button
                v-if="Number(scope.row.status) === 3"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="setTimeChange(scope.row)"
              >定时发布</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="getJobData(scope.row)"
              >查看</el-button>
              <el-button
                v-if="Number(scope.row.status) !== 4"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="showReason(scope.row)"
              >审核通过原因</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleEdit(scope.row)"
              >编辑</el-button>
              <!-- 删除 -->
              <el-popconfirm
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确认删除职位？"
                @confirm="handleDelete(scope.row)"
              >
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <pagination
          v-show="centerTotal > 0"
          :total="centerTotal"
          :page.sync="centerQueryParams.pageNo"
          :limit.sync="centerQueryParams.pageSize"
          @pagination="centerGetList"
        />
      </el-tab-pane>
      <el-tab-pane label="未发布" name="3">
        <!-- 搜索工作栏 -->
        <el-form
          ref="rightQueryForm"
          :model="rightQueryParams"
          size="small"
          :inline="true"
          label-width="78px"
        >
          <el-form-item label="职位" prop="jobName">
            <el-input
              v-model="rightQueryParams.jobName"
              placeholder="请输入职位"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="操作人" prop="updater">
            <el-input
              v-model="rightQueryParams.updater"
              placeholder="请输入操作人"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button
              icon="el-icon-refresh"
              @click="resetQuery"
            >重置</el-button>
            <el-button
              type="primary"
              icon="el-icon-search"
              @click="handleQuery"
            >搜索</el-button>
          </el-form-item>
        </el-form>
        <!-- 操作工具栏 -->
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
            >新增</el-button>
            <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="rightMultipleSelection.length === 0"
              @click="multipleSetStatus(rightMultipleSelection, '1')"
            >提交审核</el-button>
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="rightMultipleSelection.length === 0"
              @click="multipleSetStatus(rightMultipleSelection, '0')"
            >撤销审核</el-button>
            <el-button
              type="danger"
              plain
              icon="el-icon-plus"
              size="mini"
              :disabled="rightMultipleSelection.length === 0"
              @click="deleteAll(rightMultipleSelection)"
            >删除</el-button>
          </el-col>
        </el-row>
        <!-- 列表 -->
        <el-table
          v-loading="loading"
          :data="rightList"
          @selection-change="handleRightChange"
          @sort-change="({ column, prop, order }) => sortChange('right', { column, prop, order })"
        >
          <el-table-column type="selection" width="55" />
          <el-table-column label="序号" type="index" />
          <el-table-column label="职位名称" align="center" prop="jobName" />
          <el-table-column label="招聘企业" align="center" prop="companyName" />
          <el-table-column label="工作地点" align="center" prop="workPosition">
            <template slot-scope="scope">
              {{ scope.row.workPosition || "--" }}
            </template>
          </el-table-column>
          <el-table-column
            label="更新日期"
            align="center"
            prop="updateTime"
            width="180"
            sortable
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.updateTime) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="部门" align="center" prop="department" />
          <el-table-column label="职位状态" align="center" prop="status">
            <template slot-scope="scope">
              <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
              {{ statusList[scope.row.status] || "--" }}
            </template>
          </el-table-column>
          <el-table-column label="操作人" align="center" prop="updater" />
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
              <el-button
                v-if="Number(scope.row.status) === 0 || Number(scope.row.status) === 4"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row, '1')"
              >提交审核</el-button>
              <el-button
                v-if="Number(scope.row.status) === 1"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row, '0')"
              >撤销审核</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="getJobData(scope.row)"
              >查看</el-button>
              <el-button
                v-if="Number(scope.row.status) === 4"
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="showReason(scope.row)"
              >查看驳回原因</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleEdit(scope.row)"
              >编辑</el-button>
              <!-- 删除 -->
              <el-popconfirm
                confirm-button-text="确定"
                cancel-button-text="取消"
                icon="el-icon-info"
                icon-color="red"
                title="确认删除职位？"
                @confirm="handleDelete(scope.row)"
              >
                <el-button
                  slot="reference"
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                >删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <pagination
          v-show="rightTotal > 0"
          :total="rightTotal"
          :page.sync="rightQueryParams.pageNo"
          :limit.sync="rightQueryParams.pageSize"
          @pagination="rightGetList"
        />
      </el-tab-pane>
      <el-tab-pane label="回收站" name="4">
        <RecycleBin ref="recycleBin" />
      </el-tab-pane>
    </el-tabs>
    <el-button
      type="primary"
      icon="el-icon-upload2"
      size="small"
      style="position:absolute;top: 20px;right: 30px;"
      @click="mutipleImport"
    >批量导入</el-button>
    <!-- 职位编辑/新建 通过open打开，close关闭 -->
    <JobEdit
      ref="jobEdit"
      :job-data="jobForm"
      @review="openReview"
      @submit="createJob"
    />
    <!-- 查看职位详情 -->
    <el-drawer
      title="职位详情"
      size="90%"
      :visible.sync="JobDetailDialog"
      direction="rtl"
    >
      <JobDetail ref="jobDetail">
        <div slot="btnBox" class="btn-block">
          <template v-if="currentJob !== null">
            <!-- 刷新职位 -->
            <el-popconfirm
              v-if="activeName === '1'"
              confirm-button-text="确定"
              cancel-button-text="取消"
              icon="el-icon-info"
              icon-color="red"
              title="确定刷新职位日期？"
              @confirm="handleFreshDate(currentJob, true)"
            >
              <el-button
                slot="reference"
                size="mini"
                type="primary"
                style="margin-right: 15px"
                icon="el-icon-edit"
              >刷新职位</el-button>
            </el-popconfirm>
            <!-- 置顶 -->
            <el-popconfirm
              v-if="activeName === '1' && currentJob.topStatus !== '1'"
              confirm-button-text="确定"
              cancel-button-text="取消"
              icon="el-icon-info"
              icon-color="red"
              title="确定置顶职位？"
              @confirm="handleSetTop(currentJob, '1', true)"
            >
              <el-button
                slot="reference"
                size="mini"
                type="primary"
                icon="el-icon-edit"
                style="margin-right: 15px"
              >置顶</el-button>
            </el-popconfirm>
            <!-- 取消置顶 -->
            <el-popconfirm
              v-if="activeName === '1' && currentJob.topStatus === '1'"
              confirm-button-text="确定"
              cancel-button-text="取消"
              icon="el-icon-info"
              icon-color="red"
              title="确认取消置顶职位？"
              @confirm="handleSetTop(currentJob, '0', true)"
            >
              <el-button
                slot="reference"
                size="mini"
                style="margin-right: 15px"
                type="primary"
                icon="el-icon-edit"
              >取消置顶</el-button>
            </el-popconfirm>
            <!-- 暂停发布 -->
            <el-popconfirm
              v-if="Number(currentJob.status) === 2"
              confirm-button-text="确定"
              cancel-button-text="取消"
              icon="el-icon-info"
              icon-color="red"
              title="确认暂停发布职位？"
              @confirm="handleSetStatus(currentJob, '3', true)"
            >
              <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
              <el-button
                slot="reference"
                size="mini"
                style="margin-right: 15px"
                type="primary"
                icon="el-icon-edit"
              >暂停发布</el-button>
            </el-popconfirm>
            <!-- 暂停发布 -->
            <el-popconfirm
              v-if="Number(currentJob.status) === 3"
              confirm-button-text="确定"
              cancel-button-text="取消"
              icon="el-icon-info"
              icon-color="red"
              title="确认发布职位？"
              @confirm="handleSetStatus(currentJob, '2', true)"
            >
              <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
              <el-button
                slot="reference"
                size="mini"
                style="margin-right: 15px"
                type="primary"
                icon="el-icon-edit"
              >发布</el-button>
            </el-popconfirm>
            <!-- 编辑 -->
            <el-button
              size="mini"
              style="margin-right: 15px"
              type="primary"
              icon="el-icon-edit"
              @click="handleEdit(currentJob)"
            >编辑</el-button>
            <el-button
              v-if="Number(currentJob.status) === 0"
              size="mini"
              style="margin-right: 15px"
              type="primary"
              icon="el-icon-edit"
              @click="handleUpdate(currentJob, '1', true)"
            >提交审核</el-button>
            <el-button
              v-if="Number(currentJob.status) === 1"
              size="mini"
              style="margin-right: 15px"
              type="primary"
              icon="el-icon-edit"
              @click="handleUpdate(currentJob, '0', true)"
            >撤销审核</el-button>
            <!-- 删除 -->
            <el-popconfirm
              confirm-button-text="确定"
              cancel-button-text="取消"
              icon="el-icon-info"
              icon-color="red"
              title="确认删除职位？"
              @confirm="handleDelete(currentJob, true)"
            >
              <el-button
                slot="reference"
                size="mini"
                type="danger"
                style="margin-right: 15px"
                icon="el-icon-edit"
              >删除</el-button>
            </el-popconfirm>
          </template>
        </div>
      </JobDetail>
    </el-drawer>
    <!-- 职位预览 -->
    <JobReivew ref="JobReivew" />
    <!-- 批量导入职位 -->
    <el-dialog
      :title="upload.title"
      :visible.sync="upload.open"
      width="400px"
      append-to-body
    >
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :on-error="handleFileError"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload" />
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div slot="tip" class="el-upload__tip text-center">
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link
            type="primary"
            :underline="false"
            style="font-size: 12px; vertical-align: baseline"
            @click="importTemplate"
          >下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="handleFileError">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 分享弹窗 -->
    <el-dialog
      title="分享职位"
      :visible.sync="shareVisible"
      width="440px"
    >
      <div class="contents">
        <div class="item">
          <span>当前职位：</span>{{ shareData.jobName }}
        </div>
        <div class="item">{{ shareData.urls }}</div>
        <div class="item">
          <span>分享链接：</span>
          <el-button type="primary" size="small" icon="el-icon-share" @click="copyFun">复制链接</el-button>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="shareVisible = false">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 定时发布、暂停发布 -->
    <el-dialog
      :title="timeChangeTitle"
      :visible.sync="jobTimeChange"
      width="440px"
    >
      <el-form
        ref="timeChangeForm"
        :model="timeChangeForm"
        :rules="rules"
        label-width="120px"
      >
        <!-- 职位状态 jobHireStatus (string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
        <el-form-item label="日期" prop="fixedTime">
          <el-date-picker
            v-model="timeChangeForm.fixedTime"
            type="date"
            placeholder="选择日期"
            format="yyyy-MM-dd"
            value-format="yyyy-MM-dd"
            :picker-options="pickerOptionStop"
          />
        </el-form-item>
        <el-form-item label="时间" prop="hours">
          <el-time-select
            v-show="isToday"
            v-model="timeChangeForm.hours"
            placeholder="选择时间"
            :picker-options="{
              start: '00:00',
              step: '01:00',
              end: '24:00',
              minTime: new Date().getHours() + ':00',
            }"
          />
          <el-time-select
            v-show="!isToday"
            v-model="timeChangeForm.hours"
            placeholder="选择时间"
            :picker-options="{
              start: '00:00',
              step: '01:00',
              end: '24:00',
            }"
          />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="jobTimeChange = false">取 消</el-button>
        <el-button type="primary" @click="submitTimeChange">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  createJob,
  getCompanyByLoginUser,
  getJobWaitExamineList,
  getJobExamineDoneList,
  getJobExamineStopList,
  getJobInfo,
  updateJobInfo,
  deleteJob,
  deleteMutipleJob,
  updateJobDate,
  setJobTopStatus,
  setJobStatus,
  updateEnterpriseJobFixed
} from '@/api/company-admin-api/hireManage/index.js'
// 职位详情
import JobDetail from './components/jobDetail.vue'
import { businessAreaData } from '@/utils/frontDataDict.js'
import { deepClone } from '@/utils/index'
import JobEdit from './components/jobEdit.vue'
import JobReivew from './components/jobReview.vue'
import { getBaseHeader } from '@/utils/request'
import RecycleBin from './components/recycleBin.vue'
import { copyText } from '@/utils/utils'
import moment from 'moment'
export default {
  name: 'Company',
  components: {
    JobEdit,
    JobDetail,
    JobReivew,
    RecycleBin
  },
  data() {
    return {
      pickerOptionStop: {
        disabledDate: (time) => {
          return time.getTime() < Date.now() - 8.64e7
        }
      },
      timeChangeTitle: '',
      jobTimeChange: false,
      timeChangeForm: {
        fixedTime: null,
        hours: null
      },
      rules: {
        fixedTime: [
          {
            required: true,
            message: '日期不能为空',
            trigger: 'change'
          }
        ],
        hours: [
          {
            required: true,
            message: '时间不能为空',
            trigger: 'change'
          }
        ]
      },
      // <!-- 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回 -->
      statusList: {
        0: '未发布',
        1: '待审核',
        2: '发布中',
        3: '暂停发布',
        4: '驳回'
      },
      currentJob: null,
      JobDetailDialog: false,
      companyInfo: null, // 公司信息
      auditDialog: false,
      activeName: '1',
      shareVisible: false,
      shareData: { jobName: null },
      // 企业行业类型数据，二级联动
      businessAreaData: businessAreaData,
      // 遮罩层
      loading: true,
      // 发布中-总条数
      leftTotal: 0,
      // 暂停发布-总条数
      centerTotal: 0,
      // 未发布-总条数
      rightTotal: 0,
      // 发布中列表
      leftList: [],
      // 暂停发布列表
      centerList: [],
      // 未发布列表
      rightList: [],
      // 弹出层标题
      title: '',
      isEdit: false, // false 新增模式，要调用创建接口， true 编辑模式，要调用更新接口
      // 发布中列表参数
      leftQueryParams: {
        pageNo: 1,
        pageSize: 10,
        jobName: null,
        updater: null,
        flag: ['2'], // 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
        sortField: {
          field: '',
          order: ''
        }
      },
      // 暂停发布列表参数
      centerQueryParams: {
        pageNo: 1,
        pageSize: 10,
        jobName: null,
        updater: null,
        flag: ['3'], // 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
        sortField: {
          field: '',
          order: ''
        }
      },
      // 未发布列表
      rightQueryParams: {
        pageNo: 1,
        pageSize: 10,
        jobName: null,
        updater: null,
        flag: ['0', '1', '4'], // 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
        sortField: {
          field: '',
          order: ''
        }
      },
      // 职位信息表
      jobForm: {
        jobName: '', // 职位名称
        education: '', // 学历要求
        identify: '0', // 招聘对象 0在校 1应届,默认0
        city: '', // 工作城市
        workAddress: '', // 工作地址，非城市
        lowestSalary: '', // 最低薪资
        highestSalary: '', // 最高薪资
        companyName: '', // 招聘企业名称
        companyId: '', // 企业id
        welfareTags: [], // 福利标签
        jobDescription: '', // 职位描述
        workPeriod: '', // 工作周期
        practicePeriod: '', // 实习周期
        jobLanguage: '', // 工作语言
        recruitmentCount: '', // 招聘人数
        clickCount: 0, // 职位点击量，写死，后端冗余字段
        department: '', // 部门
        postCount: 0, // 职位投递量，写死，后端冗余字段
        status: 0, // 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
        salaryUnit: 'daily_salary', // 薪资类型 daily_salary weekly_salary monthly_salary annual_salary
        phone: '' // 联系人手机号
      },
      isReviewDialog: false,
      leftMultipleSelection: [],
      centerMultipleSelection: [],
      rightMultipleSelection: [],
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: '',
        // 是否禁用上传
        isUploading: false,
        // 设置上传的请求头部
        headers: getBaseHeader(),
        // 上传的地址
        url:
          process.env.VUE_APP_BASE_API + '/admin-api/enterprise/enterprise-job/import-excel'
      },
      today: moment().format('yyyy-MM-DD')
    }
  },
  computed: {
    isToday() {
      return this.timeChangeForm.fixedTime === this.today
    }
  },
  watch: {
    isToday(newValue, oldValue) {
      if (newValue !== oldValue && newValue) {
        this.timeChangeForm.hours = (new Date().getHours() + 1) + ':00'
      }
    }
  },
  created() {
    this.getCompanyInfo()
    this.leftGetList()
    // this.centerGetList()
    // this.rightGetList()
  },
  methods: {
    // 提交定时发布、暂停发布职位的数据
    submitTimeChange() {
      this.$refs.timeChangeForm.validate(boo => {
        if (boo) {
          const { fixedTime, hours } = this.timeChangeForm
          const hoursStr = hours.split(':')[0]
          // 职位状态 jobHireStatus (string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
          const status = Number(this.currentJob.status) === 2 ? 2 : 1
          const params = {
            id: this.currentJob.id,
            // 定时发布状态 0 无 1 定时发布 2 定时暂停发布
            timingStatus: status,
            fixedTime: `${fixedTime} ${hoursStr}`
          }
          updateEnterpriseJobFixed(params).then(res => {
            if (res && res.code === 0) {
              this.$message.success('设置成功')
              this.$refs.timeChangeForm.resetFields()
              this.jobTimeChange = false
              this.handleQuery()
            }
          })
        }
      })
    },
    // 打开定时发布、定时暂停发布弹窗
    setTimeChange(row) {
      this.currentJob = JSON.parse(JSON.stringify(row))
      this.timeChangeTitle = Number(this.currentJob.status) === 2 ? '设置暂停发布时间' : '设置发布时间'
      this.jobTimeChange = true
      setTimeout(() => {
        this.$refs.timeChangeForm.clearValidate()
      })
    },
    importTemplate() {
      window.open('https://demo-oss.oss-cn-beijing.aliyuncs.com/xlsx/8b7bb4a6488d4061b929c9e96597472c.xlsx', '_blank')
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit()
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true
    },
    // 上传报错，清除文件并关闭
    handleFileError() {
      this.$refs.upload.clearFiles()
      this.upload.open = false
      this.upload.isUploading = false
    },
    showReason(row) {
      const reasonType = Number(row.status) === 4 ? '驳回原因' : '通过原因'
      this.$alert(row.remark || '--', reasonType, {
        confirmButtonText: '确定',
        callback: action => {
        }
      })
    },

    showShare(row) {
      // let shaerUrl = process.env.NODE_ENV==='local'?'http://47.107.248.245/test/#/':'https://www.datarer.com/'
      const shaerUrl = process.env.NODE_ENV === 'production' ? 'https://www.datarer.com/#/' : 'http://47.107.248.245/test/#/'
      this.shareData = {
        jobName: row.jobName,
        jobId: row.id,
        urls: `${shaerUrl}sharePage?jobId=${row.id}`
      }
      this.shareVisible = true
    },
    copyFun() {
      if (copyText(this.shareData.urls)) {
        this.$message.success('复制成功，快去分享吧~')
      } else {
        this.$message.error('复制失败')
      }
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      if (response.code !== 0) {
        this.$modal.msgError(response.msg)
        return
      }
      this.$refs.upload.clearFiles()
      this.upload.open = false
      this.upload.isUploading = false
      // 拼接提示语
      const data = response.data
      let text = '创建成功数量：' + data.updateJobnames.length
      for (const username of data.updateJobnames) {
        text += '<br />&nbsp;&nbsp;&nbsp;&nbsp;' + username
      }
      text +=
        '<br />更新失败数量：' + Object.keys(data.failureJobnames).length
      for (const username in data.failureJobnames) {
        text +=
          '<br />&nbsp;&nbsp;&nbsp;&nbsp;' +
          username +
          '：' +
          data.failureJobnames[username]
      }
      this.$alert(text, '导入结果', { dangerouslyUseHTMLString: true })
      this.handleQuery()
    },
    mutipleImport() {
      this.upload.title = '职位批量导入'
      this.upload.open = true
    },
    sortChange(type, { column, prop, order }) {
      const sortType = {
        ascending: 'asc',
        descending: 'desc'
      }
      const sortField = {
        field: prop,
        order: order !== null ? sortType[order] : null
      }
      if (order === null) {
        switch (type) {
          case 'left':
            Object.assign(this.leftQueryParams.sortField, {
              field: '',
              order: ''
            })
            this.leftGetList()
            break
          case 'center':
            Object.assign(this.centerQueryParams.sortField, {
              field: '',
              order: ''
            })
            this.centerGetList()
            break
          case 'right':
            Object.assign(this.rightQueryParams.sortField, {
              field: '',
              order: ''
            })
            this.rightGetList()
            break
          default:
            break
        }
      } else {
        switch (type) {
          case 'left':
            Object.assign(this.leftQueryParams.sortField, sortField)
            this.leftGetList()
            break
          case 'center':
            Object.assign(this.centerQueryParams.sortField, sortField)
            this.centerGetList()
            break
          case 'right':
            Object.assign(this.rightQueryParams.sortField, sortField)
            this.rightGetList()
            break
          default:
            break
        }
      }
    },
    // 多选
    handleLeftChange(val) {
      this.leftMultipleSelection = val
    },
    handleCenterChange(val) {
      this.centerMultipleSelection = val
    },
    handleRightChange(val) {
      this.rightMultipleSelection = val
    },
    openReview(data) {
      this.$refs.JobReivew.open(data, this.companyInfo)
    },
    /**
     * @desc 更新职位信息
     * @param row {Object} 职位信息
     * @param status {String} 0 未发布，1 待审核，2 发布中，3 暂停发布
     */
    handleUpdate(row, status, closeDialog = false) {
      const newRow = deepClone(row)
      if (Number(status) === 1) {
        this.$confirm('职位需平台审核通过才能发布，确认提交审核？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          newRow.status = status
          updateJobInfo(newRow).then((res) => {
            if (res.code === 0 && res.data) {
              this.$message.success('已提交审核')
              closeDialog && (this.JobDetailDialog = false)
              this.rightGetList()
            }
          })
        })
      } else if (Number(status) === 0) {
        this.$confirm('职位需平台审核通过才能发布，确认撤销审核？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          newRow.status = status
          updateJobInfo(newRow).then((res) => {
            if (res.code === 0 && res.data) {
              this.$message.success('已撤销审核')
              closeDialog && (this.JobDetailDialog = false)
              this.rightGetList()
            }
          })
        })
      }
    },
    // 删除
    handleDelete(row, closeDialog = false) {
      deleteJob(row.id).then((res) => {
        if (res.code === 0 && res.data) {
          this.$message.success('删除成功')
          closeDialog && (this.JobDetailDialog = false)
          this.handleQuery()
        }
      })
    },
    // 获取账号注册公司信息，用于覆盖冗余数据
    getCompanyInfo() {
      getCompanyByLoginUser().then((res) => {
        if (res) {
          res.data.companyId = res.data.id
          this.companyInfo = deepClone(res.data)
          Object.assign(this.jobForm, res.data)
        }
      })
    },
    // 创建职位 todo bug
    createJob(formData) {
      const params = Object.assign({}, this.companyInfo, formData)
      if (this.isEdit) {
        // 职位状态 jobHireStatus (string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
        if (params.status !== '0') {
          params.status = '1'
        }
        updateJobInfo(params).then((res) => {
          if (res.code === 0 && res.data) {
            this.$message.success('操作成功')
            this.$refs.jobEdit.close()
            this.activeName = '3'
            this.handleQuery()
          }
        })
      } else {
        delete params.id // 新建不可以带id
        createJob(params).then((res) => {
          if (res) {
            this.$message.success('创建职位成功')
            this.$refs.jobEdit.close()
            this.activeName = '3'
            this.handleQuery()
          }
        })
      }
    },
    // tag切换，刷新数据
    handleClick(data) {
      const index = Number(data.index)
      switch (index) {
        case 0:
          this.leftGetList()
          break
        case 1:
          this.centerGetList()
          break
        case 2:
          this.rightGetList()
          break
        case 3:
          this.$refs.recycleBin.leftGetList()
          break
      }
    },
    // 发布中列表数据
    leftGetList() {
      this.loading = true
      // 处理查询参数
      const params = deepClone(this.leftQueryParams)
      for (const key in params) {
        if (params[key] === null || params[key] === '') {
          delete params[key]
        }
      }
      if (params.sortField.order === '') {
        delete params.sortField
      }
      // 执行查询
      getJobExamineDoneList(params).then((res) => {
        res.data.list = res.data.list.map((item) => {
          try {
            item.workPosition = JSON.parse(item.city).join('-')
          } catch (error) {
            item.workPosition = '--'
          }
          return item
        })
        this.leftList = res.data.list
        this.leftTotal = res.data.total
        this.loading = false
      })
    },
    // 暂停发布列表数据
    centerGetList() {
      this.loading = true
      // 处理查询参数
      const params = deepClone(this.centerQueryParams)
      for (const key in params) {
        if (params[key] === null || params[key] === '') {
          delete params[key]
        }
      }
      if (params.sortField.order === '') {
        delete params.sortField
      }
      // 执行查询
      getJobExamineStopList(params).then((res) => {
        res.data.list = res.data.list.map((item) => {
          try {
            item.workPosition = JSON.parse(item.city).join('-')
          } catch (error) {
            item.workPosition = '--'
          }
          return item
        })
        this.centerList = res.data.list
        this.centerTotal = res.data.total
        this.loading = false
      })
    },
    // 未发布列表数据
    rightGetList() {
      this.loading = true
      // 处理查询参数
      const params = deepClone(this.rightQueryParams)
      for (const key in params) {
        if (params[key] === null || params[key] === '') {
          delete params[key]
        }
      }
      if (params.sortField.order === '') {
        delete params.sortField
      }
      // 执行查询
      getJobWaitExamineList(params).then((res) => {
        res.data.list = res.data.list.map((item) => {
          try {
            item.workPosition = JSON.parse(item.city).join('-')
          } catch (error) {
            item.workPosition = '--'
          }
          return item
        })
        this.rightList = res.data.list
        this.rightTotal = res.data.total
        this.loading = false
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      if (this.activeName === '1') {
        this.leftQueryParams.pageNo = 1
        this.leftGetList()
      } else if (this.activeName === '2') {
        this.centerQueryParams.pageNo = 1
        this.centerGetList()
      } else {
        this.rightQueryParams.pageNo = 1
        this.rightGetList()
      }
    },
    // 重制搜索条件
    resetQuery() {
      if (this.activeName === '1') {
        this.resetForm('leftQueryForm')
        this.handleQuery()
      } else if (this.activeName === '2') {
        this.resetForm('centerQueryForm')
        this.handleQuery()
      } else {
        this.resetForm('rightQueryForm')
        this.handleQuery()
      }
    },
    // 查看职位，获取职位数据
    getJobData(row) {
      this.currentJob = deepClone(row)
      const params = {
        id: row.id
      }
      getJobInfo(params).then((res) => {
        if (res.code === 0 && res.data) {
          this.JobDetailDialog = true
          setTimeout(() => {
            this.$refs.jobDetail.open(res.data)
          })
        }
      })
    },
    /** 编辑职位信息 */
    handleEdit(row) {
      const params = { id: row.id }
      getJobInfo(params).then((res) => {
        if (res.code === 0 && res.data) {
          // 福利标签
          try {
            res.data.welfareTags = JSON.parse(res.data.welfareTags)
          } catch (error) {
            res.data.welfareTags = []
          }
          // 教育经历
          try {
            res.data.education = JSON.parse(res.data.education)
          } catch (error) {
            res.data.education = []
          }
          // 城市
          try {
            res.data.city = JSON.parse(res.data.city)
          } catch (error) {
            res.data.city = []
          }
          Object.assign(this.jobForm, res.data)
          this.isEdit = true
          this.$refs.jobEdit.open({
            isEdit: true
          })
          this.JobDetailDialog = false
        }
      })
    },
    // 新增职位
    handleAdd() {
      this.jobForm = this.$options.data().jobForm
      if (
        this.companyInfo.companyLogo !== null &&
        this.companyInfo.companyLogo !== ''
      ) {
        Object.assign(this.jobForm, this.companyInfo)
        // 福利标签
        try {
          this.jobForm.welfareTags = JSON.parse(this.jobForm.welfareTags)
        } catch (error) {
          this.jobForm.welfareTags = []
        }
        // 教育经历
        try {
          this.jobForm.education = JSON.parse(this.jobForm.education)
        } catch (error) {
          this.jobForm.education = []
        }
        // 城市
        try {
          this.jobForm.city = JSON.parse(this.jobForm.city)
        } catch (error) {
          this.jobForm.city = []
        }
        this.isEdit = false // false 新增模式，要调用创建接口， true 编辑模式，要调用更新接口
        setTimeout(() => {
          this.$refs.jobEdit.open({
            isEdit: true
          })
        })
      } else {
        this.$confirm(
          '未填写企业介绍信息前，无法发布职位，请您前往填写',
          '提示',
          {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }
        ).then(() => {
          this.$router.push({ path: '/recruit/recommend' })
        })
      }
    },
    // 更新职位日期
    handleFreshDate(row, closeDialog = false) {
      const params = deepClone(row)
      updateJobDate(params).then((res) => {
        if (res.code === 0 && res.data) {
          this.$message.success('更新职位日期成功')
          this.leftGetList()
          closeDialog && (this.JobDetailDialog = false)
        }
      })
    },
    /**
     * @description 批量设置职位置顶
     * @param {Object | Array} row 职位数据
     * @param {String} status '1' 置顶，'0'取消置顶
     * @param {Boolean} closeDialog 是否结束后关闭职位详情弹窗
     */
    handleSetTop(row, status, closeDialog = false) {
      const params = {
        ids: [],
        status: status
      }
      if (Array.isArray(row) && row.length) {
        row.map(item => {
          params.ids.push(item.id)
        })
      } else {
        params.ids = [row.id]
      }
      setJobTopStatus(params).then((res) => {
        if (res.code === 0 && res.data) {
          this.$message.success(`${status === '1' ? '置顶成功' : '取消置顶成功'}`)
          this.leftGetList()
          closeDialog && (this.JobDetailDialog = false)
        }
      })
    },
    /**
     * @description 批量设置职位置顶
     * @param {Object | Array} row 职位数据
     * @param {String} status '1' 置顶 '0'取消置顶
     * @param {Boolean} closeDialog 是否结束后关闭职位详情弹窗
     */
    handleMutipleSetTop(row, status) {
      this.$modal
        .confirm(`确认批量${status ? '置顶' : '取消置顶'}?`)
        .then(() => {
          this.handleSetTop(row, status)
        })
        .catch(() => {})
    },
    /**
     * @desc 批量设置职位状态
     * @param {Object | Array} row 职位数据
     * @param {String} status 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
     */
    handleSetStatus(row, status, closeDialog = false) {
      const params = {
        ids: [],
        status: status
      }
      const msg = {
        0: '撤销审核',
        1: '提交审核',
        2: '发布',
        3: '暂停发布',
        4: '驳回'
      }
      if (Array.isArray(row) && row.length) {
        row.map(item => {
          params.ids.push(item.id)
        })
      } else {
        params.ids = [row.id]
      }
      setJobStatus(params).then((res) => {
        if (res.code === 0 && res.data) {
          this.$message.success(`${msg[status]}成功`)
          switch (status) {
            case '0' || '1' :
              this.rightGetList()
              break
            case '2' :
              this.centerGetList()
              break
            case '3' :
              this.leftGetList()
              break
          }
          closeDialog && (this.JobDetailDialog = false)
        }
      })
    },
    // 批量刷新职位
    refreshAll() {},
    /**
     * @desc 批量设置职位状态（主要是上架、下架、撤销审核、提交审核）
     * @param {Object | Array} row 单个或多个职位
     * @param {*} status 职位状态(string)：0 未发布，1 待审核，2 发布中，3 暂停发布, 4 驳回
     */
    multipleSetStatus(row, status) {
      const msg = {
        0: '撤销审核',
        1: '提交审核',
        2: '发布',
        3: '暂停发布',
        4: '驳回'
      }
      this.$modal
        .confirm(`确认批量${msg[status]}？`)
        .then(() => {
          this.handleSetStatus(row, status)
        })
        .catch(() => {})
    },
    /**
     * @desc 批量删除职位
     * @param {Object | Array} row 单个或多个职位
     */
    deleteAll(row) {
      this.$modal
        .confirm(`确认批量删除？`)
        .then(() => {
          const params = {
            ids: []
          }
          if (Array.isArray(row) && row.length) {
            row.map(item => {
              params.ids.push(item.id)
            })
          } else {
            params.ids = [row.id]
          }
          deleteMutipleJob(params).then((res) => {
            if (res.code === 0 && res.data) {
              this.$message.success('删除成功')
              this.handleQuery()
            }
          })
        })
        .catch(() => {})
    }
  }
}
</script>
<style lang="scss" scope>
.btn-block {
  padding: 10px 40px;
}
.contents{
  width: 100%;
  .item{
    display: flex;
    width: 100%;
    padding: 12px 0;
    align-items: center;
    font-size: 16px;
    span{
      margin-right: 16px;
    }
  }
}
</style>
